<?php
//var_dump($_REQUEST);
define('HOST', 'localhost');
define('USER', 'mes');
define('PASSWORD', '111111');
define('DATABASE', 'mes');
$conn = mysqli_connect(HOST, USER, PASSWORD, DATABASE)or die('数据库连接失败' . mysqli_connect_error());
$name1=$_REQUEST['username'];
$password= md5($_REQUEST['password']);
$time=time();
$sql = "insert into user_info (name,password,time) values('$name1','$password',$time)";
//var_dump($sql);
$res = mysqli_query($conn, $sql);
if($res){
    session_start();
    $_SESSION['name']=$name1;
    echo '<script>alert("注册成功");window.location="liuyan0.php";</script>';
}else{
    echo '<script>alert("注册失败，该用户已被注册");window.location="liuyan0.php";</script>';
}
